Method and apparatus for overflowing data packets to a software-controlled memory when they do not fit into a hardware-controlled memory

ABSTRACT

A system for managing packets incoming to a data router has a local packet memory (LPM) mapped into pre-configured memory units, to store packets for processing, an external packet memory (EPM), a first storage system to store packets in the LPM, and a second storage system to store packets in the EPM. The system is characterized in that the first storage system attempts to store all incoming packets in the LPM, and for those packets that are not compatible with the LPM, relinquishes control to the second system, which stores the LPM-incompatible packets in the EPM.

CROSS-REFERENCE TO RELATED DOCUMENTS

This application is a continuation of U.S. application Ser. No.09/964,827, filed Sep. 25, 2001, now U.S. Pat. No. 7,155,516, which is acontinuation-in-part of U.S. application Ser. No. 09/881,934, now U.S.Pat. No. 7,076,630, filed on Jun. 14, 2001, which: (1) claims thebenefit of Disclosure Document No. 491,557, filed Apr. 3, 2001, (2) is acontinuation-in-part of U.S. application Ser. No. 09/602,279, now U.S.Pat. No. 7,502,876, filed Jun. 23, 2000, and (3) is acontinuation-in-part of U.S. application Ser. No. 09/737,375, filed Dec.14, 2000, now U.S. Pat. No. 7,058,064, which claims the benefit of U.S.Provisional Application No. 60/181,364, filed Feb. 8, 2000. Thereferenced applications and documents are incorporated herein byreference.

FIELD OF THE INVENTION

The present invention is in the field of digital processing and pertainsto apparatuses and methods for processing packets in routers for packetnetworks, and more particularly to methods for treating data packets inrouting operations using different types of processors and multiprocessor systems, especially in dynamic multi-streaming processors.

BACKGROUND OF THE INVENTION

Microprocessors, as is well-known in the art, are integrated circuit(IC) devices that are enabled to execute code sequences which may begeneralized as software. In the execution most microprocessors arecapable of both logic and arithmetic operations, and typically modernmicroprocessors have on-chip resources (functional units) for suchprocessing.

Microprocessors in their execution of software strings typically operateon data that is stored in memory. This data needs to be brought into thememory before the processing is done, and sometimes needs to be sent outto a device that needs it after its processing.

There are in the state-of-the-art two well-known mechanisms to bringdata into the memory and send it out to a device when necessary. Onemechanism is loading and storing the data through a sequence ofInput/Output (I/O) instructions. The other is through a direct-memoryaccess device (DMA).

In the case of a sequence of I/O instructions, the processor spendssignificant resources in explicitly moving data in and out of thememory. In the case of a DMA system, the processor programs an externalhardware circuitry to perform the data transferring. The DMA circuitryperforms all of the required memory accesses to perform the datatransfer to and from the memory, and sends an acknowledgement to theprocessor when the transfer is completed.

In both cases of memory management in the art the processor has toexplicitly perform the management of the memory, that is, to decidewhether the desired data structure fits into the available memory spaceor does not, and where in the memory to store the data. To make suchdecisions the processor needs to keep track of the regions of memorywherein useful data is stored, and regions that are free (available fordata storage). Once that data is processed, and sent out to anotherdevice or location, the region of memory formerly associated with thedata is free to be used again by new data to be brought into memory. Ifa data structure fits into the available memory, the processor needs todecide where the data structure will be stored. Also, depending on therequirements of the processing, the data structure can be stored eitherconsecutively, in which case the data structure must occupy one of theempty regions of memory; or non-consecutively, wherein the datastructure may be partitioned into pieces, and the pieces are then storedinto two or more empty regions of memory.

An advantage of consecutively storing a data structure into memory isthat the accessing of this data becomes easier, since only a pointer tothe beginning of the data is needed to access all the data.

When data is not consecutively stored into the memory, access to thedata becomes more difficult because the processor needs to determine theexplicit locations of the specific bytes it needs. This can be doneeither in software (i.e. the processor will spend its resources to dothis task) or in hardware (using a special circuitry). A drawback ofconsecutively storing the data into memory is that memory fragmentationoccurs. Memory fragmentation happens when the available chunks of memoryare smaller than the data structure that needs to be stored, but theaddition of the space of the available chunks is larger than the spaceneeded by the data structure. Thus, even though enough space exists inthe memory to store the data structure, it cannot be consecutivelystored.

In U.S. Provisional Application No. 60/181,364, there are descriptionsand drawings for a preferred architecture for a dynamic multi-streamingprocessor (DMS) for, among other tasks, packet processing. One of thefunctional areas in that architecture is a queue and related methods andcircuitry, comprising a queuing system. The dynamic queuing system andits related components are described in U.S. application Ser. No.09/737,375. In U.S. application Ser. No. 09/737,375, a novel packetmanagement unit (PMU) is described that offloads a processing core(termed a streaming processor unit, or SPU) from having to uploadpackets into or download packets from memory, as well as relieving theunit of some other functions such as memory allocation. This isaccomplished by providing a local packet memory (LPM) that ishardware-controlled, wherein data packets that fit therein are uploadedand downloaded by a hardware mechanism.

A background memory manager (BMM) for managing a memory in a dataprocessing system is known to the inventor. The memory manager hascircuitry for transferring data to and from an outside device and to andfrom a memory, a memory state map associated with the memory, and acommunication link to a processor. The BMM manages the memory,determining if each data structure fits into the memory, decidingexactly where to place the data structure in memory, performing all datatransfers between the outside device and the memory, maintaining thememory state map according to memory transactions made, and informingthe processor of new data and its location. In preferred embodiments theBMM, in the process of storing data structures into the memory, providesan identifier for each structure to the processor. The system isparticularly applicable to Internet packet processing in packet routers.

Because software-managed memory is costly in terms of developinginstructions to figure out which portions of memory within a memoryblock are free and which are available, a hardware mechanism such as theone described with reference to U.S. application Ser. No. 09/602,279enables more efficiency and therefore, cost savings. However, in orderto optimize the function of such a hardware controller, a process mustbe provided to enable integrated and optimum function between hardwarecontrol and software control of memory. One of the preferred areas ofuse for such innovation is in the area of packet processing in datarouting over networks.

A system described with reference to U.S. application Ser. No.09/881,934 is known to the inventor for allocating storage space forincoming data packets into a memory (LPM) of a packet processor. Thesystem is implemented in hardware and has a number of capabilities forpre-configuring a LPM with atomic and virtual memory blocks or pages,which are allocated for packet storage.

One of the components of the system described above ascertains packetsize of incoming data packets and determines whether or not they fitinto LPM. This is accomplished by checking allocation state for virtualpages of a smallest size that is equal to or larger than the packetsize, checking the allocation state for a next larger virtual page, andso on, until an available (not used or allocated) virtual page is foundof a size that accommodates the next data packet.

In this process, software is notified of the packet's presence and isprovided the correct information for “core processing” of packetinformation. In some cases, however, data packets may arrive at a DMSprocessor of a size that do not fit in LPM under configuredrestrictions, and must therefore either be dropped, delayed until LPMspace is available, or uploaded into some other memory. Causing a datapacket to wait until LPM has a storage block of a size to store the datapacket is not a desirable option because of priority concerns in thathigher priority packets may be held up behind a packet waiting for LPMstorage. Dropping data packets that do not fit is an option, but not themost desirable option, as many dropped packets could result in anegative effect on particular packet flow.

What is clearly needed is an efficient method of diverting oroverflowing data packets that do not fit into LPM into asoftware-controlled memory. Such a method would enable efficientprocessing while minimizing problems in packet management andaccounting.

SUMMARY OF THE INVENTION

In a preferred embodiment of the invention a system for managing packetsincoming to a data router is provided, comprising a local packet memory(LPM) mapped into pre-configured memory units to store packets forprocessing, an external packet memory (EPM), a first storage system tostore packets in the LPM, and a second storage system to store packetsin the EPM. The system is characterized in that the first storage systemattempts to store all incoming packets in the LPM. For those packetsthat are not compatible with the LPM, the first storage systemrelinquishes control to the second system, which stores theLPM-incompatible packets in the EPM.

In one embodiment the first storage system is hardware-controlled andthe second storage system is software-controlled. Further, in someembodiments the pre-configured memory units comprise memory blocks ofpre-programmed size available for consecutive packet storage within thememory. In some embodiments the data router is connected to and operateson the Internet network, and in other embodiments the data router may beconnected to and operate on a corporate wide-area-network (WAN).

In a preferred embodiment the first storage system is implemented as anintegrated circuit (IC) or IC chip set. Also in some embodiments thefirst storage system provides a memory address to the second storagesystem in the event of upload of a packet into the second memory.

In another aspect of the invention a data packet router is provided,comprising external ports to receive and send data packets from and toneighboring connected routers, and a system for managing packetsincoming to a data router, the system having a local packet memory (LPM)mapped into pre-configured memory units to store packets for processing,an external packet memory (EPM), a first storage system to store packetsin the LPM, and a second storage system to store packets in the EPM. Thefirst storage system attempts to store all incoming packets in the LPM.For those packets that are not compatible with the LPM, the firststorage system relinquishes control to the second system, which storesthe LPM-incompatible packets in the EPM.

In a preferred embodiment the first storage system ishardware-controlled and the second storage system issoftware-controlled. In some embodiments the pre-configured memory unitscomprise memory blocks of pre-programmed size available for consecutivepacket storage within the LPM.

In some embodiments the data router is connected to and operates on theInternet network. In others it operates on a corporatewide-area-network.

In yet another aspect of the invention a method for managing packetsincoming to a data router is provided, comprising the steps of: (a)attempting to store all incoming packets, by a first storage system,into a local packet memory (LPM) that is mapped into pre-configuredmemory units, (b) relinquishing packets incompatible with the LPM to asecond storage system, and (c) storing the LPM-incompatible packets inan external packet memory of the second storage system.

In some embodiments of the method the first storage system ishardware-controlled and the second storage system is softwarecontrolled. In other embodiments the data router is connected to andoperates on a corporate wide-area-network (WAN). Also, in preferredembodiments, in step (a), the pre-configured memory units comprisememory blocks of pre-programmed size available for consecutive packetstorage within the memory. The first and second storage systems may beimplemented as an integrated circuit (IC) or IC chip set. Further, insome embodiments the second storage system is software-controlled.

In yet another embodiment of the invention a method for retrieving adata packet stored in an external packet memory (EPM) in a data routeris provided, comprising the steps of: (a) receiving a notification thatpacket processing is complete for a particular packet, (b) determiningthat the particular packet does not reside in a first memory, (c)requesting software to download the packet from the external packetmemory, the download to begin at a pre-specified memory address providedwith the request, (d) downloading the data packet from the overflowmemory via software, and (e) performing routine packet accounting viahardware after the download is complete.

In some embodiments storage of packets in the EPM is enabled by auser-controlled mechanism, and if not enabled, packets found to be notcompatible with the LPM are simply dropped. Also in some embodiments, ifa first packet is dropped, a lock is asserted to prevent any otherpacket from being dropped until the system has finished all processingassociated with the first packet dropped. In some cases there is amechanism for determining a packet source, wherein a lock is assertedonly for packets having the same source as a dropped packet. Further,the mechanism for asserting a lock may involve a lock bit managed bysoftware.

In some cases lock bits are provided for each packet source, enabling alock to be device-dependent, while in others the lock bits are bits of acommon configuration register.

In embodiments of the invention taught in enabling detail below, for thefirst time a system is provided for packet handling in processing thatcan manage most packets with hardware alone into and out of a localmemory especially configured for the process, and, in the event of apacket not being compatible, that packet may be diverted to an externalmemory managed by software.

BRIEF DESCRIPTION OF THE DRAWING FIGURES

FIG. 1 is a simplified diagram of memory management by direct I/Oprocessing in the prior art.

FIG. 2 is a simplified diagram of memory management by direct memoryaccess in the prior art.

FIG. 3 is a diagram of memory management by a Background Memory Managerin a preferred embodiment of the present invention.

FIG. 4 is a block diagram illustrating a hardware-controlled memoryportion of a total processor memory.

FIG. 5 is a block diagram illustrating layout of virtual pages for adivision of the hardware-controlled memory of FIG. 4 according to anembodiment of the present invention.

FIG. 6 a is a block diagram illustrating a Fits Determination logicaccording to an embodiment of the present invention.

FIG. 6 b is a block diagram illustrating an allocation matrix accordingto an embodiment of the present invention.

FIGS. 7 a through 8 d are block diagrams illustrating a sequence ofpacket storage involving a plurality of different sized data packetsaccording to an embodiment of the present invention.

FIG. 9 is a block diagram illustrating a comparison between consecutiveand non-consecutive data storage.

FIG. 10 is a block diagram illustrating various components and logicalcommunication paths involved in packet overflow according to anembodiment of present invention.

FIG. 11 is a process flow chart illustrating logic steps for packetoverflow according to an embodiment of the present invention.

FIG. 12 is a process flow diagram illustrating steps for performingoverflow retrieval according to an embodiment of the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 is a simplified diagram of memory management in a system 104comprising a processor 100 and a memory 102 in communication with adevice 106. In this example it is necessary to bring data from device106 into memory 102 for processing, and sometimes to transmit processeddata from memory 102 to device 106, if necessary. Management in thisprior art example is by processor 100, which sends I/O commands to andreceives responses and/or interrupts from device 106 via path 108 tomanage movement of data between device 106 and memory 102 by path 110.The processor has to determine whether a data structure can fit intoavailable space in memory, and has to decide where in the memory tostore incoming data structures. Processor 100 has to fully map and trackmemory blocks into and out of memory 102, and retrieves data forprocessing and stores results, when necessary, back to memory 102 viapath 114. This memory management by I/O commands is very slow andcumbersome and uses processor resources quite liberally.

FIG. 2 is a simplified diagram of a processor system 200 in the priorart comprising a processor 100, a memory 102 and a direct memory access(DMA) device 202. This is the second of two systems by which data, inthe conventional art, is brought into a system, processed, and sent outagain, the first of which is by I/O operations as described just above.System 200 comprises a DMA device 202 which has built-in intelligence,which may be programmed by processor 100, for managing data transfers toand from memory 102. DMA device 202 is capable of compatiblecommunication with external device 106, and of moving blocks of databetween memory 102 and external device 106, bi-directionally. The actualdata transfers are handled by DMA device 202 transparently to processor100, but processor 100 must still perform the memory mapping tasks, toknow which regions of memory are occupied with data that must not becorrupted, and which regions are free to be occupied (overwritten) bynew data.

In the system of FIG. 2 processor 100 programs DMA device 202. Thiscontrol communication takes place over path 204. DMA device 202retrieves and transmits data to and from device 106 by path 208, andhandles data transfers between memory 102 and processor 100 over paths204 and 206.

In these descriptions of prior art the skilled artisan will recognizethat paths 204, 206 and 208 are virtual representations, and that actualdata transmission may be by various physical means known in the art,such as by parallel and serial bus structures operated by bus managersand the like, the bus structures interconnecting the elements anddevices shown.

FIG. 3 is a schematic diagram of a system 300 including a BackgroundMemory Manager (BMM) 302 according to an embodiment of the presentinvention. BMM 302 is a hardware mechanism enabled to manage the memoryin the background, i.e. with no intervention of the processor to decidewhere the data structure will be stored in the memory. Thus, theprocessor can utilize its resources for tasks other than to manage thememory.

The present invention in several embodiments is applicable in a generalway to many computing processes and apparatuses. For example, in apreferred embodiment the invention is applicable and advantageous in theprocessing of data packets at network nodes, such as in routers inpacket routers in the Internet. The packet processing example is usedbelow as a specific example of a practice of the present invention tospecifically describe an apparatus, connectivity and functionality.

In the embodiment of a packet router, device 106 represents aninput/output apparatus and a temporary storage of packets received fromand transmitted on a network over path 308. The network in one preferredembodiment is the well-known Internet network. Packets received from theInternet in this example are retrieved from device 106 by BMM 302, whichalso determines whether packets can fit into available regions in memoryand exactly where to store each packet, and stores the packets in memory102, where they are available to processor 100 for processing. Processor100 places results of processing back in memory 102, where the processedpackets are retrieved, if necessary, by BMM on path 312 and sent backout through device 106.

In the embodiment of FIG. 3 BMM 302 comprises a DMA 202 and also amemory state map 304. BMM 302 also comprises an interrupt handler in apreferred embodiment, and device 106 interrupts BMM 302 when a packet isreceived. When a packet is received, using DMA 202 and state map 304,the BMM performs the following tasks:

1. Decides whether a data structure fits into the memory. Whether thestructure fits into memory, then, is a function of the size of the datapacket and the present state of map 304, which indicates those regionsof memory 102 that are available for new data to be stored.2. If the incoming packet in step 1 above fits into memory, the BMMdetermines an optimal storage position. It was described above thatthere are advantages in sequential storage. Because of this, the BMM ina preferred embodiment stores packets into memory 102 in a manner tocreate a small number of large available regions, rather than a largernumber of smaller available regions.3. BMM 302 notifies processor 100 on path 310 when enough of the packetis stored, so that the processor can begin to perform the desiredprocessing. An identifier for this structure is created and provided tothe processor. The identifier communicates at a minimum the startingaddress of the packet in memory, and in some cases includes additionalinformation.4. BMM updates map 304 for all changes in the topology of the memory.This updating can be done in any of several ways, such as periodically,or every time a unit in memory is changed.5. When processing is complete on a packet the BMM has stored in memory102, the processor notifies BMM 302, which then transfers the processeddata back to device 106. This is for the particular example of a packetprocessing task. In some other embodiments data may be read out ofmemory 102 by BMM 302 and sent to different devices, or even discarded.In notifying the BMM of processed data, the processor uses the datastructure identifier previously sent by the BMM upon storage of the datain memory 102.6. The BMM updates map 304 again, and every time it causes a change inthe state of memory 102. Specifically the BMM de-allocates the region orregions of memory previously allocated to the data structure and setsthem as available for storage of other data structures, in this casepackets.

It will be apparent to the skilled artisan that there may be manyalterations in the embodiments described above without departing fromthe spirit and scope of the present invention. For example, a specificcase of operations in a data packet router was illustrated. This is asingle instance of a system wherein the invention may providesignificant advantages. There are many other systems and processes thatwill benefit as well. Further, there are a number of ways BMM 302 may beimplemented to perform the functionality described above, and there aremany systems incorporating many different kinds of processors that mightbenefit.

Low Fragmentation Data Storage

In the following described examples memory management is accomplished ina dynamic multi-streaming processor know to the inventors as XCaliber,which has been described in one or more of the documents incorporated inthe cross-reference section above.

FIG. 4 is a simplified diagram of memory space managed by XCaliberaccording to an embodiment of the present invention. Shown in thediagram are sections of memory space of the XCaliber multi-streamingprocessor that are hardware controlled, software controlled, and othertypes of memory not specifically described. In this example, a specificsection is labeled Hardware Controlled. The memory space of this sectionis analogous to LPM 219 described with reference to FIG. 2 of U.S.application Ser. No. 09/737,375 or memory 102 described with referenceto FIG. 3 of U.S. application Ser. No. 09/602,279. In this example, onlya specified section of the total available memory of XCaliber isdesignated as hardware-controlled.

Also indicated by directional arrows in this example are Packets In thatare received at the processor from a network such as, for example, thewell-known Internet network. Packets Out, similarly indicated in thisexample by directional arrows, indicate data packets that have beenprocessed by XCaliber and are being uploaded for routing to designateddestinations either internal to the router or over a network ornetworks, which may include the Internet network, to other routingpoints.

The section of hardware-controlled memory illustrated herein iscontrolled by hardware that is provided according to a preferredembodiment of the present invention and enhanced to manage the memoryaccording to a provided protocol. In an embodiment of this invention itis preferred that incoming data packets are stored into and read out ofhardware controlled memory so that the central processing unit (CPU) orother processing resources do not have to perform costly operationsinvolved in storing and reading out the data.

Although it is not explicitly indicated in this example, but is furtherdescribed below, the section of memory labeled as hardware-controlledmemory is divided into a plurality of manageable blocks. It is possiblein an embodiment of this invention that software can control none, one,or more memory blocks and leave those blocks not controlled by softwareto control of the hardware algorithm. Configuration flags are providedfor indicating assigned software control of any one or more of thememory blocks. When such a flag is set the hardware controller will notstore any incoming data packets into the flagged block.

The protocol provided in embodiments of this invention, defined by aspecific algorithm, determines if any incoming data packets fit into anyhardware-controlled blocks of memory. If incoming data packets fit intoany of the hardware-controlled blocks, the hardware algorithm enables acomputation to determine which blocks within the hardware-controlledmemory will be selected that will accommodate incoming data packets.

The novel protocol of the present invention introduces a concept ofvirtual and atomic pages as data storage containers of thehardware-controlled memory. In a preferred embodiment, virtual pagescomprise a number of atomic pages. A goal of the present invention is tobe able to reduce fragmentation that typically occurs when queuing andde-queuing data packets.

FIG. 5 is a block diagram illustrating an example of a virtual pageaccording to an embodiment of the present invention. This exampleillustrates just one of a plurality of divided sections of thehardware-controlled memory described above with reference to FIG. 4.

In actual practice, the hardware-controlled portion of memory of FIG. 4is divided into 4 blocks each having 64 Kb total memory space.Therefore, a total size of the hardware-controlled memory of FIG. 4 is256 Kb. This should, however, not be construed as a limitation of thepresent invention, as there are a number of possible division schemes aswell as possible differing amounts of provided on-board memory. In thisexample only a single block of 64 Kb is represented for simplicity indescription.

The 64 KB block of this example comprises a plurality of atomic pagedivisions having 256 bytes of memory space each. Therefore, there are inthis example, 256 atomic pages making up a single 64 Kb block and 1024atomic pages defining the four 64 Kb divisions of the totalhardware-controlled memory referred to in the example of FIG. 4 above.

Graphically represented to the right of the 64 Kb memory block in thisexample are columns representing some possible allocated sizes ofvirtual pages. For example, a 256-byte virtual page (VP) size may existthat comprises a single atomic page (1:1) thus providing 256 (0-255) VPsper 64 Kb block. A 512-byte VP size may exist with each VP comprising 2atomic pages (2:1) thus providing 128 (0-127) VPs per block. Similarly,reading further columns to the right, virtual pages may comprise 1 Kb ofmemory (0 through 63 atomic pages), 2 Kb of memory (0 through 31 atomicpages) and so on, according to power of 2 increments, up to a single 64Kb VP comprising the entire 64 Kb block.

An enhanced hardware mechanism is provided and termed HAL by theinventor, and is subsequently referred to as HAL in this specification.HAL computes and maintains a flag for each virtual page within acontrolled memory block in order to determine whether a virtual page hasbeen allocated for data storage or not. The status, including the sizeof all atomic pages is, of course, known to HAL to make computationsregarding whether or not to store an incoming data packet in aparticular space.

FIG. 6 a is a block diagram illustrating a first part of a two-partprocess of storing data packets into hardware-controlled memoryaccording to an embodiment of the present invention. In the two-partfunction, HAL makes a determination whether a particular incoming datapacket fits into any of the blocks of the hardware-controlled memory. Ifa packet fits, it is determined how many atomic pages of memory spacewill be needed to store the data packet. After packet storage, the usedspace is marked as allocated for storage of the packet. When the packetis read out of the queue, the formerly allocated space is thende-allocated or marked as free space for consideration in futurestorage.

As was previously described above, the hardware controlled memory isdivided into a plurality blocks of a fixed size. In practice in thisexample, total memory controlled by hardware (HAL) is 256 KB dividedinto 4 sub-blocks of 64 KB each. As described with reference to FIG. 5of this specification, each 64 KB block is divided into smallersub-blocks of atomic pages of 256 bytes each, which are used toconstruct virtual pages.

At left in FIG. 6 a, there is illustrated 4 64 Kb blocks of memory,which taken together equate to a total memory that is controlled by HAL.Each block, as previously described, may be hardware or softwarecontrolled. If a block is software controlled, it will be identified assuch and HAL will not utilize the block for packet storage. To the rightof the 4 64 Kb blocks, there is illustrated a state of indication foreach block. For example, an area is set aside to indicate if a block issoftware controlled. If this area does not indicate by flag that it issoftware controlled, then an allocated/de-allocated indication will bepresent. This is indicated by block 0 state through block 3 state. It isnoted herein that computation by HAL is performed in parallel for each64 Kb block.

If it is determined by HAL that there is available hardware controlledmemory and that one or more blocks have sufficient space that isde-allocated, or does not hold data, then HAL determines if the packetfits into any of the eligible spaces. It is noted herein that the bytesize of an incoming data packet is appended to the packet in thisexample in the first 2 bytes of the packet header. This is a conveniencein a preferred embodiment, but is not limiting for purposes of theinvention. In cases where no size is appended, the hardware algorithmwould simple receive all of the packet, and when it detects that thepacket has been completely received, it would compute the size of thepacket. In this way, (either way) HAL may efficiently determine eligiblespaces to store the packet. In this scheme, data packets are storedconsecutively and a goal is to have all of a packet contained in avirtual page to reduce fragmentation.

Blocks are selected for storage based on eligibility, and in some casespriority. Information generated by HAL in case of packet fit includes ablock #, the total number of atomic pages required to store the packet,and the location identifier of the first atomic page marking thebeginning of the stored data packet. Knowing the first atomic page andthe size of the data packet stored is sufficient to simplify reading thepacket out of the hardware-controlled memory, since packets areconsecutively stored.

Whether hardware or software controlled, status of selected blocks ofmemory must be computed and maintained by whichever entity (hardware orsoftware) is controlling selected blocks of memory.

To select appropriate blocks of memory, HAL must keep track of regionsof memory wherein active data is stored and regions that are free andavailable for storage. Once data packets are sent out to another deviceor location, those areas of memory associated with that data arede-allocated and available to be used again for storage of new datapackets to be stored into the memory. Once fit determination is made,the HAL records a block number, atomic pages needed for storage, and atleast a first atomic page number as a data identifier, and provides thatdata identifier to the multi-streaming processor for management of data.If a fit determination cannot be made, the controlling entity (HAL orsoftware) may have the option of storing data packets in externalstorage memory or dropping data packets.

FIG. 6 b is a block-diagram illustrating a virtual page allocationmatrix of atomic pages needed to store a data packet and there-computation (allocated/de-allocated) of the state of the virtualpages. Allocation of atomic pages is accomplished by fits determinationlogic established by the allocation matrix that is comprised of thestate of each of all virtual pages per block. The computation is updatedeach time one or more atomic pages is allocated or de-allocated and isan input back into the determination logic.

The allocation matrix maintains computation of allocated andde-allocated virtual pages relative to 256 byte, 512 byte, 1 Kb, andother power of two increments up to a 64 Kb virtual page. Allocated andDe-allocated state information is submitted as input to the fitsdetermination logic for each packet as described above.

In this example, Block j has 0-255 atomic pages representing thesmallest increment of 256 bytes. The power of two increments ofconstruction are 256 B virtual pages, 512 B virtual pages, 1 KB virtualpages, up to a 64 KB virtual page. The instant mapping scheme selectableby power of two increments is a programmable feature that may beprogrammed on the fly during packet processing.

Motivation for changing the memory mapping scheme with regard to thesize of virtual pages allocated for packet storage may, in oneembodiment, be derived from statistical averaging of the size of datapackets entering a data port over a given, and also programmable, periodof time. A goal of the present invention is to continually select thebest mapping scheme that enables data storage with minimumfragmentation. Therefore, the way that the local packet memory (hardwarecontrolled) is mapped can vary according to need. The exact criteria fordetermining when to change the mapping scheme may be established using athreshold scheme that automatically triggers a dynamic re-mapping ofhardware-controlled memory. Because of this flexibility, which is notavailable in prior art memory addressing schemes, fragmentation may bekept to a minimum. However, a trade-off exists in that using a power of2 to define selectable VP sizes is not necessarily the best way toreduce fragmentation. It is utilized in a preferred embodiment becauseit greatly simplifies computation, requiring minimum circuitry,providing for a smaller and faster chip implementation.

The primary factors of concern in this specification are an AllocationMatrix, a Fits Vector, and an Index Vector. These primary factors aredefined as follows:

-   -   AllocationMatrix[VPSize][VPIndex]: indicates whether virtual        page number VPIndex of size VPSize is already allocated or not.    -   FitsVector[VP Size]: indicates whether a block has at least one        non-allocated virtual page of size VPSize.    -   IndexVector[VPSize]: if FitsVector[VPSize] is asserted,        IndexVector[VPSize] contains an index of a non-allocated virtual        page or pages of size VPSize.

Determination of VP size for any one of a plurality of hardware managedblocks is dynamically programmed and, in some cases, re-programmedaccording to learned results of operation as previously described above.A factor defining this ongoing determination is termedEnableVector[VPSize].

The above-described factors always remain in an undefined state for anyblock managed by software instead of hardware.

A supporting algorithm expressed in software language for the fitsdetermination logic (for a data packet of size s bytes) is:

 1) Fits logic: Check, for each of the blocks, whether the data packetfits   in or not. If it fits, remember the virtual page size and thenumber of   the first virtual page of that size.    For All Block j Do(can be done in parallel):     Fits[j] = (s <= VPSize) ANDFitsVector[VPSize] AND       Not SoftwareOwned      where VPSize is thesmallest possible page     size.     If (Fits[j])      VPIndex[j] =IndexVector[VPSize]      MinVPS[j] = VPSize     Else        MinVPS[j] =<Infinit>  2) Block selection: The blocks with the smallest virtual page(enabled   or not) that is able to fit the data packet in arecandidates. The block   with the smallest enabled virtual page isselected.     If Fits[j] = FALSE for all j Then      <Packet does notfit in hardware-controlled    memory>     Else      C = set of blockswith smallest MinVPS AND Fits[MinVPS]      B = block# in C with thesmallest enabled virtual page       (if more than one exists, pick thesmallest block number)      If one or more blocks in C have virtualpages enabled Then       Index = VPIndex[B]       VPSize = MinVPS[B]      NumAPs = ceil(S/256)       packetPage = (B*64KB + Index*VPSize) >>8      Else       <Packet does not fit in hardware-controller memory>

A packetPage is an atomic page number of the first atomic page that adata packet will occupy in hardware-controlled memory. The packetPage isoffset within hardware-controlled memory and can be used to quicklyidentify and access all data of a packet stored consecutively after thatpage. The total number of atomic pages (NumAPs) needed to store a datapacket is calculated and allocated. Data packet size is determined byexamining the first 2 bytes of the packet header as previouslydescribed. Allocation of atomic pages for a selected block (j) isdetermined as follows:

-   -   The allocation status of atomic pages in        AllocationMatrix[Apsize][j..k], j being the first atomic page        and k the last one (k−j+1=NumAPs), are set to be allocated.    -   The allocation status of virtual pages in AllocationMatrix[r][s]        is updated following the mesh structure shown in FIG. 6 b: a        2^(k+1)-byte virtual page is allocated if any of the two        2^(k)-byte virtual pages that it is composed of is allocated.

FIGS. 7 a through 8 d are block diagrams illustrating allocation ofatomic (and virtual) pages by HAL. The collective diagrams numbering 8in total are associated in an ongoing sequence of page allocation andpacket storage. The 8 diagrams are further associated in sets of twomemory blocks each, for example, FIGS. 7 a and 7 b representing a firstsequence utilizing 2 memory Blocks 0 and 1. In actual practice, thereare 4 memory blocks within hardware-controlled memory. The inventorillustrates 2 Blocks 0 and 1, each comprising 2 KB of memory for purposeof simplifying explanation.

Referring now to FIG. 7 a, assume that Block 0 is hardware controlled,empty of data, and selected for packet storage. The size of a packet forstorage is 256 bytes as is indicated above the block. Options forvirtual memory allocation in variable sized virtual pages are displayedin columns to the right of Block 0 in increments of powers of 2. Thesmallest size page is an atomic page of 256 bytes. Therefore in Block 0there are 8 atomic page divisions 0-7 adding up to 2 KB (total memory).In the first column labeled 256-byteVirtual Page, there is one pageavailable (0-7) for each atomic division 0-7 because they are of thesame size. In the next column labeled 512-byte Virtual Page, there areonly 4 available virtual pages (0-3) representing total memory becauseof the power of 2 rule. The remaining columns labeled 1 KB Virtual Pageand 2 KB Virtual Page (VP) are presented accordingly using the power of2 rule.

Immediately below Block 0 is a columned table representing values ofthree Vectors described previously in this specification. These are,reading from top to bottom, Fits Vector, Index Vector, and EnableVector. The values presented in the table are associated with theVirtual Page columns. In this example, atomic division 7 is crosshatchedindicating current cycle VP allocation of a 256-byte packet. Indicationof the VP allocation by cross-hatching is extended across the presentedcolumns in each VP Size category. The cross-hatching in this exampleindicates that the corresponding atomic page is allocated. The virtualpage that contains this atomic page is then not available.

HAL computes and selects the most optimum storage space for the packetbased on determined and chosen values represented in the Vector tablefor each column. The Enable Vector is a preprogrammed constantprogrammed for each power of 2 columns. The values of yes (Y) or no (N)represented for each column indicate whether or not the function oflooking for an available Virtual Page in that column is enabled or not.The specific determination of enabling or disabling consideration of aspecific size Virtual Page during a computation cycle depends on outsideconsiderations such as knowledge of average size packets arriving at aport over a given period of time, and any desire to reserve certain sizeVirtual Pages in a given Block for storage of a specified size or sizerange of data packets. The Enable Vector is a programmable optimizationtool to enable optimum data storage with even less fragmentation.

The Fits Vector is a determination of whether a packet will fit into anavailable Virtual Page as determined by the known size of the packet,and the Index Vector is a pointer to a next available Virtual Page ineach size column for fitting a packet. While the Fits Vector isresult-oriented (computed result), the Index Vector is selectable incase there is a plurality of Index slots empty of data and available forpacket storage. For optimum data storage the last available VP that fitsa packet is chosen for storage. It could also be the first available.Either way will work, as long as it is either the last available or thefirst available.

In this example, it is determined that for selected Block 0, a packet ofthe size of 256-bytes will fit in a 256-byte virtual page (indicated bycross hatching). In the event of storage of the packet in a 256-bytevirtual page, an Index Vector of 6 (or the next 256-byte slot) isflagged for the next available “page” in memory for a next 256-bytepacket. This represents the most optimum storage use through consecutivestorage and no fragmentation, using the scheme of power of two virtualpages and fixed size of atomic pages. The packet will also fit in a512-byte virtual page, a 1 KB virtual page, and in a 2 KB virtual page.A tabled Y for Enable Vector indication is not required in the case of a2 KB virtual page as that page represents the total memory selected.

If the 256-byte packet is stored in a 512 Virtual Page it would occupy ablock in that column representing atomic divisions 6 and 7 within Block0 according to power of 2. In this case the Vectors read Y=fits, 2(chosen as pointer for next available 512-byte Virtual Page), andY=enabled for consideration. If the packets coming in average between256 and 512 bytes, it is logical to reserve 512 byte pages as indicatedby Enable Vector value of Y for that column. It is reminded that thereare three other blocks in actual practice that can be hardwarecontrolled.

Referring now to FIG. 7 b, Block 1 represents the otherhardware-controlled memory block of this example. The absence of anyactivity designated by cross-hatching simply means that Block 1 has notbeen selected for packet storage in the first cycle.

Referring now to FIG. 7 c, the activity represented in FIG. 7 a ispresent in Block 0 as double crosshatched blocks for the packet of256-bytes. For a next packet of 512-bytes in the next computation cycle,Block 0 in the column 512-bytes has atomic pages 4 and 5 allocated forreceiving the 512-byte packet. This allocation resulted from theprevious index vector of 2 represented with respect to FIG. 7 a. In thissequence, only the index vector value of 1 in the 512-byte column haschanged indicating that block as the next available 512-byte VP for anext packet of that size or smaller. Referring now to FIG. 7 d, anabsence of cross-hatching indicates that Block 1 was not selected forpacket storage in the current cycle.

Referring now to FIG. 8 a, the sequence now must deal with fitsdetermination and allocation for a 1 KB data packet as is indicatedabove Block 0. In this example, the previous activity described withreference to FIGS. 7 a (256-byte) and 7 c (512-byte) is illustratedherein as double crosshatched blocks indicating past allocation andcurrent ineligibility for consideration in this current cycle. It isalso noted that neither column (1 KB) nor column (2 KB) is enabled. Eventhough a 1 KB block may fit in the open VP in the 1 KB column, Blockselection is deferred to Block 1 illustrated with reference to FIG. 8 b.That is to say that Block 0 represented in FIG. 8 a is not selected forstorage of the 1 KB packet.

Referring now to FIG. 8 b, Fits Vector is positive (Y) for all sizecolumns. Atomic divisions 4-7 are allotted for storage of the 1 KBpacket in the current cycle as indicated by crosshatching. Index Vector3 represented in the 256-byte VP column indicates the next availablestorage index (VP) in the next cycle. It is noted herein that EnableVector values are positive in the 1 KB and 2 KB columns. In the nextcycle, there will be available 4 256-byte VPs (Index Vector 3), 2512-byte VPs (Index Vector 1), and 1 KB VP (Index Vector 0), availablefor consideration for storage of a next packet. It is noted that VP 2-KBis not considered in the algorithm for a next cycle be cause it has beenallotted.

FIGS. 8 c and 8 d illustrate further operations involving packets of 512bytes, and can be understood in light of the above descriptions.

FIG. 9 is an illustration of how memory space is better utilized byconsecutive storage according to an embodiment of the present invention.This example illustrated two scenarios, A and B, wherein two 256-bytedata packets are stored in a block. In SCENARIO A, a 256-byte virtualpage is randomly chosen, whereas in SCENARIO B, the largest index vectoris always chosen. As can be seen, the block in SCENARIO A only allowstwo 512-byte virtual pages to be considered at a next round whereas theblock in SCENARIO B allows three VPs. Both, however, allow the samenumber of 256-byte data packets since this is the smallest allocationunit. The same optimization may be obtained by choosing the smallestvirtual page index number all the time.

It is noted herein that assignment of Virtual Pages as explained in theexamples of FIG. 7 a through FIG. 9 is performed in parallel for allmemory blocks of hardware-controlled memory that are not flagged forsoftware control.

Packet Overflow Apparatus and Method

In one aspect of the present invention a method for overflowing datapackets incoming into a data router is provided wherein, if the packetsare deemed not suitable for hardware-controlled packet storage, thenthey are instead diverted to a memory controlled by software or someother external memory without disrupting packet information queuing andaccounting procedures.

FIG. 10 is a block diagram illustrating various components of a DMSprocessor 5000 and logical communication paths between componentsinvolved in a packet-overflow operation according to an embodiment ofpresent invention. DMS processor 5000 comprises four basic functionalunits. These are a network interface (NI) 5001, a system interface unit(SIU) 5002, a packet management unit (PMU) 5004, and a streamingprocessor unit (SPU) 5011. These basic components making up processor5000 are all described with reference to disclosure associated withFIGS. 1-3 of U.S. application Ser. No. 09/737,375. A goal of the presentinvention is to provide a method by which these components interact whennecessary to conduct packet overflow without disturbing packetaccounting.

The functional descriptions regarding components 5001, 5002, 5004, and5011 are analogous to functions described with reference to FIGS. 1-3 ofU.S. application Ser. No. 09/737,375 and therefore will not bere-visited with much granularity herein in this specification exceptwhen to do so aids in understanding of the present invention. Thosedescriptions and the figures are also a part of the presentspecification.

NIA 5001 is an external interface for DMS 5000 in terms of networkfunction. NIA 5001 has, at least one ingress station and a like numberof egress stations. Not shown are in-bound and out-bound buffers. Inthis example, NIA 5001 is logically represented herein as having a 0/1Ingress location and a 0/1 Egress station adapted for accepting dataarriving from the network or another device, and for sending processeddata back to the network or another device. In actual practice of theinvention, each port on DMS 5000 is bi-directional and may operate atfull or half duplex according to pre-configuration. The 0 in 0/1represents a single device ID that is sending data into NIA 5001 forbuffering (not shown). The 1 in 0/1 represents another single device IDthat is sending data to DMS 5000. Similarly, Egress 1/0 representsbuffered data being sent out of DMS 5000 according to their intendedreceiving devices. In one aspect, a sending and receiving device may bethe same device receiving messages back from DMS 5000 after firstsending data for processing.

SIU 5002 serves as a system interface between PMU 5004 and most otherrouter components. A direct memory access engine (DMA) 5003 isillustrated within SIU 5002, and is utilized as a well-known tool foraccessing and transferring data packets between separate memories orfrom a buffering system into a memory as performed by software.

PMU 5004 is responsible for packet management and accounting. A queuingsystem (QS) 5008 is provided within PMU 5004 and adapted for queuingpacket identifiers and other pertinent information about data packets inthe system. QS 5008 is dynamic and updated as packets are processed andsent out of DMS 5000. Functions and capabilities of QS 5008 aredependent upon read and write requests occurring during packetprocessing.

A packet memory management unit (PMMU) 5010 is provided within PMU 5004and adapted to provide packet identifiers and to allocate and manageblocks of memory where packets will be stored during processing withinDMS 5000. Much detail about the PMMU is provided in the description ofU.S. application Ser. No. 09/737,375, more particularly under thesections entitled “Overview of the PMU” and “Paging Memory ManagementUnit (PMMU)”. The terms packet and paging are both used in the acronymPMMU as the first term in the acronym. Packet memory refers to memorythat data packets will occupy during processing, and paging memoryrefers to actual pre-configured pages of memory (atomic and virtual)allocated for packet storage, and therefore is synonymous with packetmemory. Much detail about the QS is provided in the disclosure of U.S.application Ser. No. 09/737,375, as the specification focuses on thenovel aspects of the QS in a DMS processor.

A local packet memory (LPM) 5006 is provided within PMU 5004 and adaptedas a hardware-controlled memory as described with reference to U.S.application Ser. No. 09/737,375 throughout the specification. LPM 5006has memory allocations of specifically-sized blocks for facilitatingconsecutive data packet storage. Atomic pages and virtual pages areterms of U.S. application Ser. No. 09/737,375 used to describe thesize-specific (bytes) memory blocks. It is noted that such sizeallocations are somewhat dynamic, meaning that specific size parametersmay be changed during configuration for adapting to changing packetsizes of packets coming into DMS 5000. LPM is described in thisspecification as hardware-controlled memory.

A register transfer unit (RTU) 5007 is provided within PMU 5004 andadapted to select available context registers maintained within aprocessing core that are adapted to accept pre-loaded packet informationfor processing. RTU 5007 keeps track of which contexts are available toPMU 5004 and which the processing core owns. RTU 5007 is a transfer unitin the literal sense in that ownership of context registers is literallytransferred between the PMU and a processing core illustrated herein asa streaming processor unit (SPU) 5011. The context registers arerepresented logically in this example by a block labeled Context withinSPU 5011 and assigned the element number 5012. There is a plurality ofcontext registers in actual practice.

SPU 5011 is responsible for processing data-packet information accordingto information loaded into context 5012. As described above in referenceto DMS technology as known to the inventor, SPU 5011 is capable ofsimultaneously executing multiple processing streams or instructions. Asoftware-controlled memory 5013, referred to with reference to U.S.application Ser. No. 09/737,375 as EPM for external packet memory, isprovided for software controlled packet storage. In this embodiment,memory 5013 is implemented externally from LPM 5006. In anotherembodiment it may be a sectored part of a total memory block of whichLPM is a part. In still another embodiment memory 5013 may be memory ofa peripheral system connected to DMS 5000. There are many possiblelocations for memory 5013.

In practice, it is a preferred method of the present invention to divertdata packets from NIA 5001 to memory 5013 in cases where the packets aredetermined not to fit in LPM 5006, which is a preferred location fordata packet storage. However, no matter how diversified the memory-blocksize configuration for LPM 5006 may be, it is still probable that someincoming packets will not be compatible for LPM storage. Attempting tostore such packets in LPM 5006 can cause fragmentation and loss of data.

All data packets stored within LPM 5006 of PMU 5004 arrive through SIU5002 by way of NIA 5001. Therefore, SIU 5002 is referred to in thisspecification as the sender of data packets whether or not they areaccepted by the PMU. PMU 5004 is notified when a next data packet forprocessing arrives and must decide whether or not the packet will beuploaded to LPM 5006 or diverted to an external (software controlled)memory. To accomplish this, the PMU has to have the size information ofthe data packet. In one embodiment, SIU 5002 begins to send the datapacket to PMU 5004. The size of the packet is the first data PMU 5004will receive. If PMMU 5010 determines that the packet will not fit inLPM 5006, then it will halt the upload and request an overflow. Inanother embodiment, SIU 5002 simply sends a control message containingjust the size information of the packet. PMMU 5010 then determines fitstatus and notifies SIU 5002 whether or not it will accept the packet.In the case of overflow, PMMU 5010 additionally provides memoryaddresses in the software-controlled memory to the SIU for the packet inthe same transaction. After a packet is being uploaded, whether intoSW-controlled memory or into LPM, QS 5008 will eventually have all ofthe required data about the packet. PMMU 5010, which is the hardwaremechanism responsible for fit determination, provides memory addressallocation, and provision of packet identification after upload, as wellas an accounting function after eventual download of the packet toegress.

PMMU 5010 is logically illustrated as having communication capabilitywith QS 5008 via a solid double-arrowed line connecting the two systemcomponents. If PMMU 5010 determines that the next packet fits in LPM5006 (i.e. there is de-allocated or otherwise available LPM toconsecutively store the packet), then PMU 5004 will upload the packetinto LPM 5006. A broken double arrow emanating from within SIU 5002 andprogressing into LPM 5006 logically illustrates this case. In this case,PMMU 5010 has allocated the virtual page or pages to store the packetand will provide a packet identifier to QS 5008 after uploading iscomplete. PMMU also has updated the memory allocation state of LPM 5006after uploading the packet into LPM 5006.

RTU 5007 is logically illustrated as in direct communication with PMMU5010 by a solid double-arrowed line connecting the two systemcomponents. RTU 5007 is responsible for selecting and pre-loading anavailable context from contexts 5012 for SPU processing. A brokendouble-arrowed line emanating from RTU 5007 and intersecting with anillustrated SIU/SPU communication path 5014 represents this case. WhenSPU 5011 notifies PMU 5004 that the packet processing is completed, thenPMU 5004 downloads the packet out of LPM 5006 to Egress (interface5001). The PMU can be configured not to overflow a packet when it doesnot fit into the LPM. If this is the case, the packet will be dropped. Aconfiguration register (not illustrated) within PMU is provided to storethe flag bit. In the case that a packet is dropped because it isdetermined not to fit in LPM 5006, PMU 5004 receives the entire packet.That is, from the point of view of the sender of that packet (SIU), thepacket was successfully sent into the PMU. However, PMU 5004 performs nofunctions associated with the packet and all packet data is discarded.

For accounting purposes only, PMU 5004 notifies software that a packetdrop has occurred. This notification occurs through an interrupt to theSPU core. A stream running on SPU 5010 can respond to the generatedinterrupt and take whatever action is currently specified. For example,SW might generate and send a control packet to the external device thatoriginally sent the dropped packet as an alert that the packet wasdropped. SW may instead just execute an increment to a counter thatkeeps record of the total number of dropped packets for bookkeepingpurposes.

It is noted herein that PMU 5004 does not allow any other packet fromthat same input device ID to be dropped until SW has been notified ofthe packet drop event, and until SW has completed processing any actiontaken regarding the packet-drop event.

In order to insure that a second packet is not dropped before SW has hada chance to react to the initial packet drop, PMU 5004, moreparticularly PMMU 5010, implements a locking mechanism for the inputdevice ID that is the originator of the dropped packet, so that noadditional packets from that device will be dropped until software hascleared the lock. This is accomplished by writing a new value into aconfiguration register within PMU 5004 adapted for the purpose. Such aregister may also have other information about the dropped packetinserted therein. If a subsequent packet arrives from the same device IDbefore the lock is cleared and that packet needs to also be dropped, itwill wait in a buffer until the lock is cleared by SW. The asserted lockon a device ID resulting from a dropped packet in the system is specificonly to that particular device ID experiencing a dropped packet and doesnot affect packets coming in that are determined to fit in LPM 5006.

In a preferred embodiment, the interrupt generated by the PMU to letsoftware know of a new packet drop is shared among the different deviceIDs. In other words, one or more packets might have been dropped by thetime software takes the interrupt). Thus, the value of the lock bit(s)should be visible by software. A solution is to implement these lockbit(s) as configuration registers that software can both write (to clearthe drop condition) and read (to figure out from which device ID thepacket(s) got dropped).

Now consider a data packet arriving through NIA 5001 that will not fitinto LPM 5006 wherein PMU 5004 is configured (flag) for packet overflowenabled. In this case PMU 5004 is notified of the packet arrival by SIU5002 as described above. PMMU 5010 determines the size of the incomingdata packet and checks whether there is any space in LPM 5006 to storethe packet. If it is determined that there is no space within LPM 5006to store the incoming packet, then PMMU 5010 initiates a request to, inthis case, SIU 5002 for packet overflow according to the flag activatedwithin PMU 5004. In the case of data packet overflow, PMU 5004 will notupload or physically receive the packet from SIU 5002.

In the case of packet overflow initiation, then PMU 5004 sends a requestto SIU 5002 to upload the data packet into, in this case, SW controlledmemory 5013. SIU 5002 utilizes DMA 5003 to gain access to memory 5013over a logically illustrated data path represented herein by a soliddouble-arrowed line, connecting component SIU to memory 5013. In thiscase, the data packet is transferred from an in buffer (not illustrated)in SIU 5002 directly into memory 5013 with no direct PMU involvementexcept that SIU 5002 accesses some information provided by the PMUthrough configuration registers.

PMMU 5010 performs some additional functions, in case of softwarestorage (overflow), that are not performed in conjunction with LPMpacket storage. A context register CR 5005 is provided within PMU 5004and adapted to store at least one or, in some cases, more than onememory pointer or beginning address to available memory blocks or pagesin memory 5013. PMMU 5010 provides at least a next beginning memoryaddress for a packet that will be overflowed into memory 5013. PMMU 5010also provides a packet identifier for the overflowed packet after thatpacket has been uploaded by SW just as it would if the packet fit LPM5006 and was stored there instead of being overflowed. In this case, SIU5002 performs the actual uploading and downloading. In anotherembodiment an alternate SW unit may be adapted to perform uploads anddownloads of packets destined for memory 5013. Further, a packetuploaded into EPM could be downloaded from LPM (and vice-versa) ifsoftware has explicitly moved the packet from one memory to the otherone.

QS 5008 has all of the information about the overflowed packet just asit would for packet stored in hardware-controlled memory. In oneembodiment PMMU 5010 sets a lock bit 5009 in CR 5005 that is specific tothe device ID representing the originator of the overflowed data packet.This lock bit is different from the previous lock bit described aboveregarding the packet drop mechanism. In this case there are twophysically different lock bits. In an alternative embodiment there is alock mechanism that fulfills all of the lock functions by specifying nolock, lock due to drop or lock due to overflow.

Lock 5009 prevents overflow initiation of subsequent data packets fromthat device ID until SPU 5011 has acknowledged the notification of theoverflow. The PMU notifies SW when a packet overflow operation is inprogress. RTU 5007 is notified of a request for a context by software ifsoftware does not already own an available context. The lock bit iscleared by provision of a new beginning memory address for a nextoverflow packet.

Each time a packet is uploaded to or downloaded from memory 5013 by SIU5002, PMU 5004 must request the action and provide the starting addresswhere the packet will be uploaded to or downloaded from. SPU 5011notifies PMU 5004 after processing. The method of the present inventionis integrated with the PMMU function and exercised during normal packetrouting operations. PMU 5004 generates a SW interrupt whenever a datapacket is being overflowed into memory 5013. SW running in a stream inSPU 5011 looks up and provides a next starting address within memory5013 for a next data packet that might be overflowed. In this way,packets from a same device ID that need to be overflowed do not have towait for a previous packet to be completely processed and downloadedfrom memory 5013.

In one embodiment of the present invention, the method is device IDspecific, such that the lock bit is set to prevent a subsequent packetoverflow from initiating before a previous packet from the same deviceID has been acknowledged and a new address has been computed and writteninto CR 5005. For example if input device 0 has a packet in overflow anda subsequent packet from 0 has arrived and is determined to requireoverflow, then that subsequent packet must wait until a new address iswritten into CR 5005. In this case, a packet arriving from device ID 1would have an address specific to that packet and could be overflowedsimultaneously with a packet from device 0. In another embodiment, themethod of the invention is device ID independent and a lock bit appliesto all input device IDs for upload into software-controlled memory.However, for download from software-controlled memory, the method isdevice dependent concerning all output device IDs. In preferredembodiments, upon the download of the packets, there is no need for lockbits, since the processing is already done and there is no need to syncup with software.

It will be apparent to one with skill in the art that the method andapparatus of the present invention can be applied to any data nodeinvolved in data routing without departing from the spirit and scope ofthe invention, as long as the physical hardware is present including twodistinct memories. In one embodiment, a separate hardware-controlledmemory may be provided for overflowing data packets that do not fit in aprimary hardware-controlled memory. Moreover, a third memory that issoftware-controlled may be provided as an ultimate backup for packetsnot fitting into either of the hardware-controlled memories. There aremany configuration possibilities.

FIG. 11 is a process flow chart illustrating logic steps for packetoverflow upload according to an embodiment of the present invention. Atstep 5100, a packet management unit analogous to PMU 5004 described withreference to FIG. 10 is notified of the arrival of a data packet forprocessing. At this step, the data packet is in buffer in a systeminterface unit (SIU) and originates from one of existing input devices.At step 5101, PMU determines if the pending packet fits into localpacket memory (LPM). The PMU is aware of the size of the packet andchecks if there are any pages available within LPM to store the packet.This process is algorithmic in nature. A page memory management unitanalogous to PMMU 5010 of FIG. 10 above performs the actual computationusing an algorithm.

If the pending packet fits into LPM at step 5101, then at step 5110 thePMU uploads the packet into LPM. In this case, of course, there is nopacket overflow process. In one embodiment, the packet may be droppedafter step 5101 if it is determined that the packet does not fit intothe LPM and packet overflow is not enabled within the PMU.

If it is determined at step 5101 that the packet does not fit into LPMand packet overflow is enabled within the PMU, then at step 5102, thePMU sends a request to the SIU to overflow the packet into SW-controlledmemory. The request includes a beginning address in SW memory analogousto memory 5013 of FIG. 10 where the packet should be uploaded. The PMUaddress is taken from an overflow-address configuration register. Thisregister is updated by software when a next address is available foroverflow of a next data packet.

At this point the PMU has not accepted the data packet and will not bedirectly involved in getting the data packet into SW memory. Onlyaccounting functions are performed at the PMU level for packets notresiding in LPM memory. At step 5103, the SIU uploads the data packetinto the SW-controlled memory. At step 5104, which may run concurrentlywith step 5103, the PMU sets a lock-bit into the overflow addressregister and writes some additional packet information into additionalregisters that software may access and read. This information includespacket size (SizeOfPacket) and the time of initialization of the packetoverflow (OverflowTimeStamp).

At step 5105, the PMU generates a software interrupt to notify softwarethat a packet overflow has been initialized. This step may logicallybegin after step 5102, and may be performed in parallel with steps 5102,5103 and 5104. The purpose for this interrupt is so that software canimmediately compute a next beginning address for overflowing a next datapacket. The software writes the computed address into the overflowaddress register clearing the lock bit. It is noted herein and describedfurther above that there may be two modes for overflow into SW memory.In one mode, the lock-bit set in the overflow address register, which isanalogous to CR 5005 and lock 5009 described with reference to FIG. 10above, is device ID independent in terms of input devices. That is tosay that if device 0 is locked, no packet overflow can occur on packetssent from that device until the lock is cleared. A packet arriving fromdevice 1 may be overflowed even if the lock for device 0 is set. In analternative mode, there is no device dependency, and the lock is commonto all input device IDs registered.

At step 5106, the PMU waits for the SIU to complete the overflow,assigns a packet identifier to the packet, and inserts the packet intothe QS. At step 5107 the PMU waits for software to clear the lock bit orbits. Software (running on the SPU) determines the address in EPM wherea next packet to be overflowed will be stored. This value is written ina config register of the PMU, which triggers the clearance of theoverflow lock bits or lock-bit register. Writing the new value into theregister does not need to occur when the overflowed packet is fullyprocessed. It can be done immediately after an interrupt is generatedand taken by software. In a preferred embodiment, the functional aspectof determining that a packet needs to be overflowed and initiating therequest to trigger the overflow interaction is performed by the pagememory management unit or PMMU analogous to PMMU 5010 described withreference to FIG. 10 above. The process steps described herein assumesthat a flag is set to packet overflow instead of packet drop.

It will be apparent to one with skill in the art that the process stepsdescribed herein may be further granulated into sub-steps withoutdeparting from the spirit and scope of the invention. For example, instep 5104 the PMU may be responsible for initiating multiple locks thatare each specific to an input device ID.

FIG. 12 is a process flow diagram illustrating steps for performingoverflow retrieval according to an embodiment of the present invention.At step 5200, the PMU determines that a packet that has been completelyprocessed and ready for egress is not present in LPM. Preceding thisdetermination, SW has notified PMU that the packet processing of theparticular packet is complete.

At step 5201, the PMU sends a request to the SIU to download the packetfrom SW-controlled memory. At step 5203, the PMU provides the memoryaddress pointing to the beginning of where the packet resides inSW-controlled memory to the SIU. In one embodiment of the presentinvention steps 5201 and 5202 are accomplished in a single transactionbetween the PMU and SIU. The PMU waits for the SIU to finish downloadingthe packet to an egress buffer within the SIU at step 5204. At step 5205the PMU performs all of the bookkeeping and accounting functions for theegressed packet just as it would for any other data packet leaving thesystem.

It is noted herein that the overflow process is performed independentlywith regard to download from memory for each registered output deviceID. That is to say that packets residing in SW-controlled memory aredownloaded and sent out one at a time per device ID. It is also notedherein that software interrupts generated to tell SW to look for a nextoverflow address are also device independent in one mode. That is, SWmust determine which device ID needs a new memory address for a packetto arrive for overflow. In a preferred embodiment the required data iswritten into an overflow lock register maintained within the PMU.

In the disclosure teaching thus far, it is assumed that there is no datapacket interleaving with respect to port transmission. In other words, aport may transmit only one packet at a time. Moreover, the addressallocation mechanism relies on this fact. However, the preferredapplication of the invention should not be construed as limited tooverflow of only one packet at a time from any given port. Withadditional hardware implemented within the PMU, more than one packetfrom a same port may be overflowed as long as enough registers exist tostore the required extra information.

It will be apparent to one skilled in the art that the embodiments ofthe invention described in this specification are exemplary, and mayvary in a multitude of ways without departing from the spirit and scopeof the present invention. It will also be apparent to one skilled in theart that many alternatives, variations, and configurations are possibleand the scope of the invention is limited only by the claims thatfollow.

1. A system for managing packets incoming to a data router comprising: alocal packet memory (LPM) configured to store packets for processing; anexternal packet memory (EPM) for storing overflow data which is notstorable by said LPM; a first storage system coupled to the LPM and to asecond storage system; wherein the first storage system is configuredto: determine whether said packets can be stored in the LPM; if a givenpacket is determined not to be storable within the LPM: relinquishpacket management to the second storage system; set a first lock; andset a second lock corresponding to an originating device of the givenpacket; and wherein the second storage system is configured to: receivean indication from the first storage system that the given packet is notstorable in the LPM; in response to receiving the indication, manage thegiven packet; and wherein setting the first lock causes the system tobuffer additional incoming packets until the system completes a firstaction in response to the determination that the given packet is notstorable within the LPM and wherein setting the second lock causes thesystem to prevent packet overflow from initiating for subsequent packetsfrom the same originating device before receiving an acknowledgement. 2.The system of claim 1 wherein to manage the given packet, the secondstorage system is further configured to drop the given packet.
 3. Thesystem of claim 2 wherein the first action comprises sending a controlpacket to an external device from which the given packet was receivedindicating that the given packet was dropped.
 4. The system of claim 1wherein to manage the given packet, the second storage system is furtherconfigured to store the given packet in the EPM.
 5. The system of claim4 wherein the first storage system provides a memory address to thesecond storage system if the given packet cannot be stored in the LPM.6. The system of claim 5 wherein the first action comprises determininga next memory address at which to store a next packet in the EPM.
 7. Thesystem of claim 1 wherein the first storage system is hardwarecontrolled and the second storage system is software-controlled.
 8. Thesystem of claim 1 wherein the LPM is mapped into pre-configured memoryunits.
 9. A data packet router comprising: external ports to receive andsend data packets from and to neighboring connected routers; a systemcoupled to the external ports and configured to manage packets incomingto the data packet router, the system comprising: a local packet memory(LPM) configured to store packets for processing; an external packetmemory (EPM) for storing overflow data which is not storable by saidLPM; a first storage system coupled to the LPM and to a second storagesystem; wherein the first storage system is configured to: determinewhether said packets can be stored in the LPM; if a given packet isdetermined not to be storable within the LPM: relinquish packetmanagement to the second storage system; and set a lock; and wherein thesecond storage system is configured to: receive an indication from thefirst storage system that the given packet is not storable in the LPM;in response to receiving the indication, manage the given packet; andwherein setting the lock causes the system to buffer additional incomingpackets until the system completes a first action in response to thedetermination that the given packet is not storable within the LPM. 10.The router of claim 9 wherein to manage the given packet, the secondstorage system is further configured to drop the given packet.
 11. Therouter of claim 10 wherein the first action comprises sending a controlpacket to an external device from which the given packet was receivedindicating that the given packet was dropped.
 12. The router of claim 9wherein to manage the given packet, the second storage system is furtherconfigured to store the given packet in the EPM.
 13. The router of claim12 wherein the first storage system provides a memory address to thesecond storage system if the given packet cannot be stored in the LPM.14. The router of claim 13 wherein the first action comprisesdetermining a next memory address at which to store a next packet in theEPM.
 15. The router of claim 9 wherein the first storage system ishardware controlled and the second storage system issoftware-controlled.
 16. The router of claim 9 wherein the LPM is mappedinto pre-configured memory units.
 17. A method for managing packetsincoming to a data router, the method comprising: storing incomingpackets for processing in a local packet memory (LPM); determiningwhether a given packet can be stored in the LPM by a first storagesystem; if the given packet is determined not to be storable within theLPM: sending an indication to a second storage system; and setting afirst lock; and setting a second lock corresponding to an originatingdevice of the given packet; and the second storage system: receiving theindication that the given packet is not storable in the LPM; in responseto receiving the indication, managing the given packet; wherein settingthe first lock causes the system to buffer additional incoming packetsuntil the system completes a first action in response to thedetermination that the given packet is not storable within the LPM andwherein setting the second lock causes the system to prevent packetoverflow from initiating for subsequent packets from the sameoriginating device before receiving an acknowledgement.
 18. The methodof claim 17 wherein managing the given packet further comprises droppingthe given packet.
 19. The method of claim 18 wherein the first actioncomprises sending a control packet to an external device from which thegiven packet was received indicating that the given packet was dropped.20. The method of claim 17 wherein managing the given packet furthercomprises storing the given packet in an external packet memory (EPM).21. The method of claim 20 further comprising providing a memory addressto the second storage system if the given packet cannot be stored in theLPM.
 22. The method of claim 21 wherein the first action comprisesdetermining a next memory address at which to store a next packet in theEPM.
 23. The method of claim 17 wherein the LPM is mapped intopre-configured memory units.